package com.zry.study.ui.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import kr.co.namee.permissiongen.PermissionGen;

public class PermissionActivity extends AppCompatActivity {
	@Override
	protected void onCreate(@Nullable Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		getTakePicPermission();
	}
	
	//申请拍照和文件读写权限
	public void getTakePicPermission() {
		
		PermissionGen.with(this)
			.addRequestCode(1000)
			.permissions(
				//电话通讯录
				android.Manifest.permission.GET_ACCOUNTS,
				android.Manifest.permission.READ_PHONE_STATE,
				//位置
				android.Manifest.permission.ACCESS_FINE_LOCATION,
				android.Manifest.permission.ACCESS_COARSE_LOCATION,
				android.Manifest.permission.ACCESS_FINE_LOCATION,
				//相机、麦克风
				android.Manifest.permission.RECORD_AUDIO,
				android.Manifest.permission.WAKE_LOCK,
				android.Manifest.permission.CAMERA,
				//存储空间SD卡读写权限
				android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
				android.Manifest.permission.WRITE_SETTINGS,
				android.Manifest.permission.READ_EXTERNAL_STORAGE,
				//读取手机状态
				android.Manifest.permission.ACCESS_WIFI_STATE,
				android.Manifest.permission.ACCESS_NETWORK_STATE,
				android.Manifest.permission.MODIFY_AUDIO_SETTINGS,
				android.Manifest.permission.CALL_PHONE
			)
			.request();
	}
	
	
	
	//申请打电话权限
	
	public void getPhonePermission() {
		PermissionGen.with(this)
			.addRequestCode(1000)
			.permissions(
				//电话通讯录
				android.Manifest.permission.GET_ACCOUNTS,
				android.Manifest.permission.READ_PHONE_STATE,
				android.Manifest.permission.CALL_PHONE
			)
			.request();
	}
}



